import 'dart:ui';

import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flutter_flame/config/GameColors.dart';

import '../../../config/GameConfig.dart';
import '../GameWorld.dart';

// 拖动影子组件
class DragShadow extends SpriteComponent
    with GameConfig, TapCallbacks, HasWorldReference<GameWorld> {
  DragShadow(
    Sprite sprite, {
    Vector2? setSize,
    Color? paintColor,
  }) : super(
          sprite: sprite,
          size: setSize ?? Vector2.all(60.0),
        ) {
    paint = Paint()..color = paintColor ?? GameColors.defaultDragShadowColor;
    priority = dragPlantShadowPriority;
  }

  // 再次点击
  @override
  void onTapDown(TapDownEvent event) {
    world.removePlant();
    super.onTapDown(event);
  }
}
